package org.darkforest.common.services.impl;

import org.darkforest.common.services.OrderPayService;
import org.darkforest.dao.mapper.OrderPayMapper;
import org.darkforest.model.OrderPay;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Libing on 2015/7/13.
 */
@Service
public class OrderPayServiceImpl implements OrderPayService {

    @Autowired
    private OrderPayMapper orderPayMapper;

    public void insert(OrderPay orderPay) {
        orderPayMapper.insertSelective(orderPay);
    }

    /**
     * 根据订单支付条件查询支付信息
     *
     * @param orderPay
     * @return
     */
    public List<OrderPay> findOrderPayInfoByCondition(OrderPay orderPay) {
        return orderPayMapper.findOrderPayInfoByCondition(orderPay);
    }

    /**
     * 根据支付id查询支付信息
     * @param payId
     * @return
     */
    public OrderPay selectByPrimaryKey(Integer payId){
        return orderPayMapper.selectByPrimaryKey(payId);
    }

    @Override
    public OrderPay selectByOrderSn(Long orderSn) {
        return orderPayMapper.selectByOrderSn(orderSn);
    }


    /**
     * 修改订单支付信息
     *
     * @param orderPay1
     */
    public void update(OrderPay orderPay1) {
        orderPayMapper.updateByPrimaryKeySelective(orderPay1);
    }





}
